<?php





function count_zaocan_num($username,$search_key)
{

    $sqlstrs="select COUNT(order_date) from orderlist where
             user_name = '".$username."' and
             order_at = '1' and
             search_key ='".$search_key."'";
    $querys = mysql_query($sqlstrs);
    $sums = mysql_result($querys, 0);
    $sum="IGNOR";

if($sums){
    $sqlstr="select COUNT(distinct(order_date)) from orderlist where
             user_name = '".$username."' and
             order_at = '1' and
             search_key ='".$search_key."'";
    $query = mysql_query($sqlstr);
    $sum = mysql_result($query, 0);
}
    return $sum;
}


function count_zaocan_cost($username,$search_key)
{
    $sqlstr="select sum(product_price) from orderlist where
             user_name = '".$username."' and
             order_at = '1' and
             search_key ='".$search_key."'";
    $query = mysql_query($sqlstr);
    $sum = mysql_result($query, 0);
    return $sum;
}


function count_wucan_num()
{
    ;
}


function count_wucan_cost()
{
    ;
}



function count_wancan_num($username,$search_key)
{
    $sqlstrs = "select COUNT(order_date) from orderlist where
             user_name = '" . $username . "' and
             order_at = '3' and
             search_key ='" . $search_key . "'";
    $querys  = mysql_query($sqlstrs);
    $sums    = mysql_result($querys, 0);

    $sum     = "IGNOR";

    if ($sums) {

        $sqlstr = "select COUNT(distinct(order_date)) from orderlist where
             user_name = '" . $username . "' and
             order_at = '3' and
             search_key ='" . $search_key . "'";

    $query = mysql_query($sqlstr);
    $sum   = mysql_result($query, 0);

}
    return $sum;
}


function count_wancan_cost($username,$search_key)
{
    $sqlstr="select sum(product_price) from orderlist where
             user_name = '".$username."' and
             order_at = '3' and
             search_key ='".$search_key."'";
    $query = mysql_query($sqlstr);
    $sum = mysql_result($query, 0);
    return $sum;
}


function count_all_cost()
{
    ;
}



?>